package cn.zr.aitool.view;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;

/**
 * 文件名称: AlertDialogHelper
 * 功能描述:
 *
 * @author: zhengrui
 * 创建时间: 2018/9/7 11:12
 * 责任人:
 * 备份责任人:
 * 修改人:
 * 修改内容:
 * 修改时间:2018/9/7 11:12
 * Copyright (C) 2018 猎户星空
 */
public class AlertDialogHelper {
    public static void showDialog(Activity ac, String title, final DialogInterface.OnClickListener listener) {
        AlertDialog dialog = new AlertDialog.Builder(ac)
                .setTitle(title)
                //设置对话框的按钮
                .setNegativeButton("取消", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                    }
                })
                .setPositiveButton("确定", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        listener.onClick(dialog, which);
                        dialog.dismiss();
                    }
                }).create();
        dialog.show();
    }
}
